package main

import "fmt"

func sum(a []int, c chan int) {
	value := 0
	for _, v := range a {
		value += v
	}
	c <- value
}

func main() {
	arr := []int{1, 2, 3, 4, 5, 6}
	c := make(chan int)

	go sum(arr[3:], c)
	go sum(arr[:3], c)

	x, y := <-c, <-c
	fmt.Println(x, y)
}
